FROM golang:1.15.1-alpine3.12 AS builder
WORKDIR /ghc
COPY go.mod .
RUN go env -w GO111MODULE=on \
    && go env -w GOPROXY=https://goproxy.cn,direct \
    && go mod download
COPY . .
RUN go build -o ghc

FROM alpine:3.12.0 AS prod
WORKDIR /home/ghc
COPY --from=builder /ghc/ghc .
COPY config.yaml .
ENTRYPOINT ["./ghc"]
CMD ["test"]